﻿using GameAPI.Models.Place;
using GameLogic.Place;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace GameAPI.Controllers
{
    public class PlaceController : ApiController
    {
        private readonly TileManager _tileManager;

        public PlaceController()
        {
            _tileManager = new TileManager();
        }

        public HttpResponseMessage GetTiles(GetTilesRequestModel model)
        {
            if (model == null ||
                model.PlaceId == null ||
                model.PlaceId == Guid.Empty)
            {
                Request.CreateResponse(HttpStatusCode.BadRequest, "Request model is invalid. No NULL values");
            }

            var tiles = _tileManager.GetTiles(model.PlaceId);

            return Request.CreateResponse(HttpStatusCode.OK, tiles);
        }
    }
}
